package com.cf.apiInstance.service.impl;

import java.util.Date;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.cf.apiInstance.dao.ApiLogMapper;
import com.cf.apiInstance.domain.ApiLog;
import com.cf.apiInstance.domain.ApiLogExample;
import com.cf.apiInstance.service.LogService;

/**
 * 日志实现类
 * 
 * @author: cf
 * @date: 29 Nov 2018 11:05:22 am
 * @vesion: 1.0
 */
@Service
public class LogServiceImpl implements LogService {

	@Resource
	private ApiLogMapper apiLogMapper;

	@Override
	public void saveLog(ApiLog log) {
		apiLogMapper.insert(log);
	}

	@Override
	public void clearLogsPassDay(Date time) {
		ApiLogExample example = new ApiLogExample();
		example.createCriteria().andCreateTimeLessThanOrEqualTo(time);
		apiLogMapper.deleteByExample(example);
	}

}
